package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;

import java.util.Random;

@Service
public class HelloServiceImpl implements HelloService {

    @Override
    public String sayHello(String name, int timeToWait) {
        return "hello:"+name;
    }

    @Override
    public String methodA(String msg) {
        Random random = new Random();
        int num = random.nextInt(101);
        try {
            Thread.sleep(num);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodA, sleep " + num + " ms";
    }

    @Override
    public String methodB(String msg) {
        Random random = new Random();
        int num = random.nextInt(101);
        try {
            Thread.sleep(num);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodB, sleep " + num + " ms";
    }

    @Override
    public String methodC(String msg) {
        Random random = new Random();
        int num = random.nextInt(101);
        try {
            Thread.sleep(num);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "methodC, sleep " + num + " ms";
    }
}
